
#pragma once

#include "EventSystem.h"
#include "ProcessSystem.h"
#include "Scheduler.h"
#include <boost/noncopyable.hpp>


//! Aggregate class which contains an Event Manager, a Process Manager and
//! a Task Manager. 
//!
class Control : boost::noncopyable
{
	ProcessManager * mProcMngr;
	EventManager * mEventMngr;
	Scheduler * mScheduler;

	void Init()
	{
		mProcMngr = new ProcessManager;
		mEventMngr = new EventManager("Ctrl");
		mScheduler = new Scheduler;
	}

	void DeInit()
	{
		delete mProcMngr;
		delete mEventMngr;
		delete mScheduler;
		mProcMngr = 0; 
		mEventMngr = 0; 
		mScheduler = 0;
	}

public:

	ProcessManager & GetProcessMngr() { return *mProcMngr; }
	EventManager & GetEventMngr() { return *mEventMngr; }
	Scheduler & GetScheduler() { return *mScheduler; }

	Control() 
	{
		Init();
	} 

	void Reset()
	{
		DeInit();
		Init();
	}

	virtual ~Control()
	{
		
	}

};

extern Control ctrl;